﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UMLDesigner
{
    public partial class AttributesWindow : Form
    {
        Boolean modificar;
        public AttributesWindow()
        {
            InitializeComponent();
             modificar = false;
            listBoxAttibutes.DataSource = DataType.types;
            listBoxVisibility.DataSource = VisibilityType.GetTypes();
           
        }
        public AttributesWindow(AttributeData attr):this()
        {
             modificar = true;
            textBoxAttributeName.Text = attr.GetName();
            listBoxAttibutes.Text = attr.GetType();
            listBoxAttibutes.Text = attr.GetVisibility();
        }


        private void Atributos_Load(object sender, EventArgs e)
        {

        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (!modificar)
            {
                WindowsManager.AddAttributeToForm(textBoxAttributeName.Text, listBoxAttibutes.Text, listBoxVisibility.Text);
            }
            else
            {
                WindowsManager.ModifyAttribute(textBoxAttributeName.Text, listBoxAttibutes.Text, listBoxVisibility.Text);
            }
            Close();
        }

       
    }
}
